225e2f51f58dc992dfdcd0a85b9bdd72a6baf7af,src/freenet/clients/http/filter/PNGFilter.java,PNGFilter,readFilter,#Bucket#BucketFactory#String#HashMap#FilterCallback#boolean#boolean#boolean#OutputStream#,89

Before Change


				String chunkTypeString = null;
				// Length of the chunk
				byte[] lengthBytes = new byte[4];
				if(dis.read(lengthBytes) < 4)
					throw new IOException("The length of the chunk is invalid!");
				
				int length = ((lengthBytes[0] & 0xff) << 24) + ((lengthBytes[1] & 0xff) << 16) + ((lengthBytes[2] & 0xff) << 8) + (lengthBytes[3] & 0xff);
				if(logMINOR)
					Logger.minor(this, "length " + length);
				if(dos != null)
					dos.write(lengthBytes);

				// Type of the chunk : Should match [a-zA-Z]{4}
				if(dis.read(lengthBytes) < 4)
					throw new IOException("The name of the chunk is invalid!");
				StringBuffer sb = new StringBuffer();
				byte[] chunkTypeBytes = new byte[4];
				for(int i = 0; i < 4; i++) {
					char val = (char) lengthBytes[i];
					if((val >= 65 && val <= 99) || (val >= 97 && val <= 122)) {
						chunkTypeBytes[i] = lengthBytes[i];
						sb.append(val);
					} else
						throw new IOException("The name of the chunk is invalid!");
				}
				chunkTypeString = sb.toString();
				if(logMINOR)
					Logger.minor(this, "name " + chunkTypeString);

				// Content of the chunk
				byte[] chunkData = new byte[length];
				int readLength = dis.read(chunkData, 0, length);
				if(readLength < length)
					throw new IOException("The data in the chunk '" + chunkTypeString + "' is " + readLength + " but should be " + length);
				if(logMINOR)

After Change



				// Content of the chunk
				byte[] chunkData = new byte[length];
				dis.readFully(chunkData, 0, length);
				if(logMINOR)
					if(logDEBUG)
						Logger.minor(this, "data " + (chunkData.length == 0 ? "null" : HexUtil.bytesToHex(chunkData)));